package OnlineExam.login;

import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.*;

public final class HomeForm extends ActionForm 
{
    
	private String username;
	public String getUsername ()
	{
		return this.username;
	}
	public void setUsername (String username)
	{
		this.username= username;
	}
	private String password;
	public String getPassword ()
	{
		return this.password;
	}
	public void setPassword (String password)
	{
		this.password = password;
	}

	/** 
	 * Input validation.
	 */
	
		
	public ActionErrors validate(ActionMapping mapping,HttpServletRequest request) 
	{

		servlet.log ("Username : "+ username);
    	servlet.log ("Password : "+ password);      
		
		ActionErrors errors = new ActionErrors();
    
		if (username == null || username.equals("")) 
		{
      		errors.add("Username", new ActionMessage("error.Username"));
    	}

		else if (password == null || password.equals("")) 
		{
      		errors.add("Password", new ActionMessage("error.Password"));
    	}

		System.out.println ("error set:" + errors);
    	return errors;	
  	}
	
}
